summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan/present/present_push_constants.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/renderer_vulkan/present/present_push_constants.h')
-rw-r--r--src/video_core/renderer_vulkan/present/present_push_constants.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/present/present_push_constants.h b/src/video_core/renderer_vulkan/present/present_push_constants.h
new file mode 100644
index 000000000..f1949e7aa
--- /dev/null
+++ b/src/video_core/renderer_vulkan/present/present_push_constants.h
@@ -0,0 +1,34 @@
+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "common/common_types.h"
+
+namespace Vulkan {
+
+struct ScreenRectVertex {
+ ScreenRectVertex() = default;
+ explicit ScreenRectVertex(f32 x, f32 y, f32 u, f32 v) : position{{x, y}}, tex_coord{{u, v}} {}
+
+ std::array<f32, 2> position;
+ std::array<f32, 2> tex_coord;
+};
+
+static inline std::array<f32, 4 * 4> MakeOrthographicMatrix(f32 width, f32 height) {
+ // clang-format off
+ return { 2.f / width, 0.f, 0.f, 0.f,
+ 0.f, 2.f / height, 0.f, 0.f,
+ 0.f, 0.f, 1.f, 0.f,
+ -1.f, -1.f, 0.f, 1.f};
+ // clang-format on
+}
+
+struct PresentPushConstants {
+ std::array<f32, 4 * 4> modelview_matrix;
+ std::array<ScreenRectVertex, 4> vertices;
+};
+
+static_assert(sizeof(PresentPushConstants) <= 128, "Push constants are too large");
+
+} // namespace Vulkan